<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
    <span id="sid">DOM元素1</span><br>
    <span class="txt">DOM元素2</span><br>
    <span class="txt">DOM元素3</span><br>

    <script>

        let s1 = document.querySelector('#sid');
        //alert(s1);
        // 需求：将dom元素1 修改成 hello Dom
        //alert(s1.innerHTML);
        s1.innerHTML = "hello Dom";

        //2.通过css选择器获取单个元素对象--如果存在多个只取第一个
        let s2 = document.querySelectorAll('.txt');
        //alert(s2);
        s2.forEach((s)=>{
            s.innerHTML = 'Hello DOm';
        })
    </script>
</body>
</html>